<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		 <script src="../js/jQuery-2.1.4.min.js"></script>
		 <script src="new/0831/infovis.min.js"></script>
	</head>
	<body>
		  <div id="test" style="width: 500px; height: 300px; border: 1px solid red;"></div>
 		<div>
 			<button onclick="cleartest()">清除</button>
 			<button onclick="create()">创建</button>
 			<button onclick="getInstance()">console</button>
 		</div>
	</body>
	<script>
			var engine;
		  $.getJSON('test2.json', function(config) {
             engine = infovis.init(config || {});
               });
        function cleartest(){
        	var instance=engine.chartInstances["test"];
//			instance.clear();
			console.log(engine)
			  engine.dispose("test");
//          $("#test").empty();
        	$("#test").remove();
        	var dom = '<div id="test" style="width: 500px; height: 300px; border: 1px solid red;"></div>';
   		
        	$("body").prepend(dom)
        	
//      	 $("#test").empty();
        }
        function create(){
        	
            if(engine) {          
                engine.render("test", "dataset02", "chart1") 
            }
      
        	
        }
        
        function getInstance(){
            engine=infovis.reload(true).init(config || {});
            var instance=engine.chartInstances["test"];
            console.log(instance);
            instance.resize();
        }
	</script>
</html>
